package com.fahai.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Description 控制后台页面跳转页面
 * @Author heshichao
 * @Time 下午6:45
 * @Version 1.0
 */

@Controller
@EnableGlobalMethodSecurity(prePostEnabled = true)
@RequestMapping(value = "/page")
public class PageController {
    private static Logger logger = LoggerFactory.getLogger(PageController.class);


    @PreAuthorize(value = "hasAuthority('CUSTOMER-0'||'ADMIN')")
    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public String wechatPage(HttpServletRequest request, HttpSession session) throws IOException {
       return "demo_index";
    }


    @RequestMapping(value = "/403", method = RequestMethod.GET)
    public String errorPage403(HttpServletRequest request, HttpSession session) throws IOException {
        return "error/403";
    }


    @RequestMapping(value = "/404", method = RequestMethod.GET)
    public String errorPage404(HttpServletRequest request, HttpSession session) throws IOException {
        return "error/404";
    }



//

}
